package com.lei.day1rikao.presenter;

import com.lei.day1rikao.LCallback;
import com.lei.day1rikao.contract.LoginContract;
import com.lei.mvpdemo.presenter.BasePresenter;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;

import java.util.HashMap;

public class LoginPresenter extends BasePresenter<LoginContract.Model, LoginContract.View> implements LoginContract.Presenter {

    public LoginPresenter(LoginContract.Model mmodel, LoginContract.View mview) {
        super(mmodel, mview);
    }

    @Override
    public void log(HashMap<String, String> map) {
        mmodel.login(map, new StringCallback() {
            @Override
            public void onSuccess(Response<String> response) {
                String body = response.body();
                if (body!=null){
                    mview.showmsg("登陆成功");
                }
            }
        });
    }

    @Override
    public void destroy() {

    }
}
